feat(31): shared invariants module in quickwit-dst#6246
Open
g-talbot wants to merge 4 commits intogtt/phase-31-pg-metastorefrom
Open
feat(31): shared invariants module in quickwit-dst#6246g-talbot wants to merge 4 commits intogtt/phase-31-pg-metastorefrom
g-talbot wants to merge 4 commits intogtt/phase-31-pg-metastorefrom
Conversation
4 tasks
| quickwit_cli::logger::setup_dogstatsd_exporter(build_info)?; | ||
|
|
||
| #[cfg(not(any(test, feature = "testsuite")))] | ||
| quickwit_cli::logger::setup_invariant_recorder(); |
Collaborator
There was a problem hiding this comment.
can we group those two into one thing?
Maybe call it:
quickwit_cli_logger::setup_metrics();
| } | ||
|
|
||
| #[cfg(not(any(test, feature = "testsuite")))] | ||
| fn invariant_recorder(id: quickwit_dst::invariants::InvariantId, passed: bool) { |
fulmicoton-dd
approved these changes
Mar 31, 2026
c8836d6 to
eccf657
Compare
3eb3316 to
c4418dd
Compare
6eeaecd to
f2113e5
Compare
aa5ff45 to
142ddd6
Compare
f2113e5 to
0d561b4
Compare
142ddd6 to
972bd20
Compare
0d561b4 to
8ba9201
Compare
972bd20 to
73c90c4
Compare
8ba9201 to
0761d11
Compare
73c90c4 to
44bd6bb
Compare
0761d11 to
b551b13
Compare
44bd6bb to
add1902
Compare
b551b13 to
398cdf2
Compare
add1902 to
d88f67f
Compare
3289f58 to
dbbbd8b
Compare
d88f67f to
b5b840e
Compare
dbbbd8b to
54a1f95
Compare
c8e6070 to
cc704b5
Compare
54a1f95 to
9696d99
Compare
bf93060 to
cedd6ca
Compare
bf23ab3 to
a60b361
Compare
cedd6ca to
02cf95d
Compare
dfa774f to
6a26333
Compare
c9634ed to
1df615d
Compare
25a1d84 to
c4694ca
Compare
0c39228 to
3b1e48d
Compare
c4694ca to
461fbb1
Compare
3b1e48d to
251ec57
Compare
13693e7 to
963fddb
Compare
c4cbf0e to
a96e8f5
Compare
b8c3a1d to
142e42a
Compare
a96e8f5 to
9f71553
Compare
142e42a to
c23e666
Compare
9f71553 to
d7a7e05
Compare
c23e666 to
ee0c5a4
Compare
d7a7e05 to
2c2eea2
Compare
Extract duplicated invariant logic into a shared `invariants/` module within `quickwit-dst`. This is the "single source of truth" layer in the verification pyramid — used by stateright models, production debug_assert checks, and (future) Datadog metrics emission. Key changes: - `invariants/registry.rs`: InvariantId enum (20 variants) with Display - `invariants/window.rs`: shared window_start_secs(), is_valid_window_duration() - `invariants/sort.rs`: generic compare_with_null_ordering() for SS-2 - `invariants/check.rs`: check_invariant! macro wrapping debug_assert - stateright gated behind `model-checking` feature (optional dep) - quickwit-parquet-engine uses shared functions and check_invariant! Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The check_invariant! macro now always evaluates the condition — not just in debug builds. This implements Layer 4 (Production) of the verification stack: invariant checks run in release, with results forwarded to a pluggable InvariantRecorder for Datadog metrics emission. - Debug builds: panic on violation (debug_assert, Layer 3) - All builds: evaluate condition, call recorder (Layer 4) - set_invariant_recorder() wires up statsd at process startup - No recorder registered = no-op (single OnceLock load) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Emit cloudprem.pomsky.invariant.checked and .violated counters with invariant label via the metrics crate / DogStatsD exporter at process startup, completing Layer 4 of the verification stack. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ee0c5a4 to
605708e
Compare
2c2eea2 to
29cc07f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
invariants/module toquickwit-dst— the single source of truth for invariant definitions shared across the verification pyramid (TLA+ specs, stateright models, production code)InvariantIdenum catalogs all 20 invariants (SS-1..5, TW-1..3, CS-1..3, MC-1..4, DM-1..5) with Display and descriptionswindow_start_secs(),is_valid_window_duration(),compare_with_null_ordering()check_invariant!macro always evaluates the condition (debug and release), implementing both Layer 3 (Prevention —debug_assert!panic in debug) and Layer 4 (Production — pluggableInvariantRecorderfor Datadog metrics)set_invariant_recorder(fn)wires up statsd at process startup; no recorder = no-op (singleOnceLockload)staterightis now an optional dependency behindmodel-checkingfeature — production crates pull only the invariant definitions, not the model checkerquickwit-parquet-engineuses shared functions andcheck_invariant!macro instead of inlinedebug_assert!Stacks on
gtt/phase-31-pg-metastore(PR #6245).Test plan
cargo test -p quickwit-dst— 11 invariant unit tests + 2 doctests passcargo test -p quickwit-dst --features model-checking— all 24 tests pass (stateright models use shared functions)cargo test -p quickwit-parquet-engine— all 153 tests passcargo test -p quickwit-metastore --all-features— all 187 tests pass (including postgres)cargo test -p quickwit-indexing --all-features— 234 pass (8 pre-existing Pulsar/GCP PubSub flakes skipped)cargo test -p quickwit-integration-tests --all-features— all 46 passcargo clippy -p quickwit-dst --all-features --tests— cleancargo clippy -p quickwit-parquet-engine --all-features --tests— clean🤖 Generated with Claude Code